# 合并pdf文件

from PyPDF2 import PdfReader, PdfWriter


def merge_pdf(path1, path2):
    write = PdfWriter()
    for path in [path1, path2]:
        tmp_pdf = PdfReader(open(path, 'rb'))
        for page in tmp_pdf.pages:
            write.add_page(page)

    with open('../02.py_pdfFile/02.合并pdf文件.pdf', 'wb') as out:
        write.write(out)


if __name__ == '__main__':
    merge_pdf('../02.py_pdfFile/01.采购合同模板.pdf', '../02.py_pdfFile/01.京A00000违章通知书.pdf')
